import java.io.IOException;
import java.util.StringTokenizer;

public class Main{

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		java.io.BufferedReader r = new java.io.BufferedReader(
				new java.io.InputStreamReader(System.in));

		while (true) {
			String s = r.readLine();
			StringTokenizer tokenizer = new StringTokenizer(s);
			int a = Integer.parseInt(tokenizer.nextToken());
			int b = Integer.parseInt(tokenizer.nextToken());
			int c = Integer.parseInt(tokenizer.nextToken());
			String result = null;
			if (a == 0 && b == 0 && c == 0)
				break;

			if (a != 0 && b * (b / a) == c) {
				result = "GP " + ((b / a) * c);
			} else {
				result = "AP " + ((b - a) + c);
			}
			System.out.println(result);
		}
	}

}


